<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>六西格玛知识管理</title>
<link href="<?php echo $this->baseUrl ?>/public/style/style.css" rel="stylesheet" type="text/css">
<link href="<?php echo $this->baseUrl;?>/public/style/daterangepicker.css" rel="stylesheet" type="text/css" />
<link href="<?php echo $this->baseUrl;?>/public/style/jquery-ui.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="<?php echo $this->baseUrl;?>/public/scripts/jquery.js"></script>
<script type="text/javascript" src="<?php echo $this->baseUrl;?>/public/scripts/daterangepicker.js"></script>
<script type="text/javascript" src="<?php echo $this->baseUrl;?>/public/scripts/jquery-ui.js"></script>
</head>

<body>
<!--头部-->
<?php echo $this->partial('common/header.html', array('template'=>$this->template, 'baseUrl'=>$this->baseUrl)) ?>

<!--主体-->
<div class="main-box" id="mainBox">
    <div class="third-menu">
        <?php echo $this->partial('common/operation.html', array('template'=>$this->template, 'baseUrl'=>$this->baseUrl)) ?>
        <div class="menu-title"><span class="icon"></span>教学产品列表页</div>
    </div>
	<div class="search">
        <form method="get" action="" name="search">
            <label>教学产品名称:</label>
            <input type="text" class="input" name="search_name" value="<?php echo !empty($_GET['search_name'])?$_GET['search_name']:'' ?>" />
            <input type="submit" class="submit input" value="搜 索" />
        </form>
	</div>
	<div class="main-list">
        <table class="main-list-table">
            <?php if ($this->products): ?>
            <tr class="table-head"><td class="th-name">教学产品名称</td><td class="th-console">操 作</td></tr>
            <tr class="table-point"><td></td><td></td></tr>
            <?php foreach ($this->products as $key => $val): ?>
            <tr>
                <td class="name">
                <a href="<?php echo $this->baseUrl ?>/product/detail?product_id=<?php echo $val['product_id']; ?>">
                <?php
                    if(!empty($_GET['search_name'])){
                        $val['name'] = str_replace($_GET['search_name'], "<font color='red'>".$_GET['search_name']."</font>", $val['name']);
                    }
                    echo $val['name'];
                ?>
                </a>
                </td>
                <td><?php $uid = $val['user_id']; $group_id = $_SESSION['user']['group_id'];$user_id = $_SESSION['user']['user_id'];?><div class="console"><a href="<?php echo $this->baseUrl ?>/product/file?product_id=<?php echo $val['product_id']; ?>" class="edit">设置附件</a><a href="<?php echo $this->baseUrl ?>/product/course?product_id=<?php echo $val['product_id']; ?>" class="edit">设置课程</a> <a href="<?php echo $this->baseUrl ?>/product/edit?product_id=<?php echo $val['product_id']; ?>" class="edit" <?php if(($uid!=$user_id)&&($group_id!=5)){ ?>onclick="alert('您没有权限修改！');return false;" <?php }?> >修改</a> <a href="<?php echo $this->baseUrl ?>/product/delete?product_id=<?php echo $val['product_id']; ?>" class="delete" <?php if(($uid!=$user_id)&&($group_id!=5)){ ?>onclick="alert('您没有权限删除！');return false;" <?php }else{?> onClick="return confirm('您确定要删除吗？')?true:false;" <?php }?>>删除</a></div></td>
            </tr>
            <?php endforeach; ?>
            <?php else: ?>
            暂无信息
            <?php endif; ?>
        </table>
    
        <div class="page-bar">
            <p>总数：<span class="total-count"><?php echo $this->total ?></span></p>
            <p>
            <?php if ($this->page > 1): ?>
            <a href="<?php echo $this->baseUrl ?>/product/list?page=1">首页</a>
            <?php else: ?>
            首页
            <?php endif; ?>
            <?php if ($this->page > 1): ?>
            <a href="<?php echo $this->baseUrl ?>/product/list?page=<?php echo $this->page-1 ?>">上一页</a>
            <?php else: ?>
            上一页
            <?php endif; ?>
            <?php if ($this->page < $this->pages): ?>
            <a href="<?php echo $this->baseUrl ?>/product/list?page=<?php echo $this->page+1 ?>">下一页</a>
            <?php else: ?>
            下一页
            <?php endif; ?>
            <?php if ($this->page < $this->pages): ?>
            <a href="<?php echo $this->baseUrl ?>/product/list?page=<?php echo $this->pages ?>">尾页</a>
            <?php else: ?>
            尾页
            <?php endif; ?>
            </p>
            <p>页数：<span class="page-detail"><?php echo $this->page ?>/<?php echo $this->pages ?></span></p>
            <p>转到 
                <select id="page_select">
                    <?php
                        for($i=1; $i<=$this->pages; $i++){
                            if ($this->page == $i) {
                                echo "<option value='$i' selected='selected'>$i/$this->pages</option>";
                            }else{
                                echo "<option value='$i'>$i/$this->pages</option>";
                            }
                        }
                    ?>
                </select>
            </p>
        </div>
	</div>
</div>
<script>
$(document).ready(function(){
	$("#page_select").change(function(){
		var page = $(this).val();
		location.href = "<?php echo $this->baseUrl ?>/product/list?page="+page;
	});
});
</script>









<!--底部-->
<?php echo $this->partial('common/footer.html') ?>
</body>
</html>
